<?php

class Application_Form_Zaloguj extends Zend_Form {

    public function init() {


        $password = new Zend_Form_Element_Password('password', array(
                    'label' => 'Hasło:',
                ));
        $password->setRequired(true);


        $login = new Zend_Form_Element_Text('login', array(
                    'label' => 'Login:'
                ));
        $login
                ->setRequired(true)
                ->addValidator('notEmpty')
                ->addValidator('stringLength', false, array(3, 16));

        $helppass = new Zend_Form_Element_Text('recover', array(
                    'label' => 'Nie pamiętasz hasła?',
                    'class' => 'fl helppass',
                ));
        $helppass->setValue($this->getView()->url(array('module' => 'default', 'controller' => 'index', 'action' => 'recoverpass'), 'default', true));

        $helppass->setDecorators(array(
            array('ViewScript', array('viewScript' => '_link.phtml'))
        ));

        $helpregister = new Zend_Form_Element_Text('register', array(
                    'label' => 'Nie masz jeszcze konta?',
                    'class' => 'fl helpreg',
                ));
        $helpregister->setDecorators(array('ViewHelper'));
        $helpregister->setDecorators(array(
            array('ViewScript', array('viewScript' => '_link.phtml'))
        ));


        $helpregister->setValue($this->getView()->url(array('module' => 'default', 'controller' => 'index', 'action' => 'rejestruj'), 'default', true));


        $this->addDisplayGroup(array(
            $login, $password
                ), 'gr-main');
        $this->addDisplayGroup(array(
            $helppass, $helpregister
                ), 'gr-help');

        $submit = new Zend_Form_Element_Submit('submit', array(
                    'label' => 'Zaloguj się',
                    'class' => 'ui-form-button'
                ));
        $submit->setDecorators(array('ViewHelper'));

        $this->addDisplayGroup(array(
            $submit
                ), 'gr-submit', array(
            'order' => 999
        ));
    }

}

